<%@ page language="java" contentType="text/html; charset=UTF-8"
  pageEncoding="UTF-8"%>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%>
<%@ taglib prefix="fmt" uri="http://java.sun.com/jsp/jstl/fmt"%>
<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c"%> 
<%@ taglib prefix="fn" uri="http://java.sun.com/jsp/jstl/functions"%>
<!DOCTYPE html>
<html lang="zh-CN">

<head>
<title>飞腾会-FitaClub</title>
<%@ include file="/WEB-INF/include/meta.jsp"%>
<%@ include file="/WEB-INF/include/css.jsp"%>
</head>
<!-- end header -->

<body>
  <div class="page-group">
    <div class="page page-current bg-light-gray">
      <header class="bar bar-nav fita-header">
        <a href="javascript:history.back(-1);" class="icon icon-left pull-left"></a>
        <a class="icon icon-menu pull-right open-panel"></a>
        <h1 class="title">立即支付</h1>
      </header>
      
      <!-- <div class="bar bar-footer fita-footer ">
        <a href="javascript:void(0);" class="button">微信支付</a>
      </div> -->
      
      <div class="content">
        <div class="card order-info-card">
          <div class="card-content">
            <div class="item" style="position: relative; margin-bottom: .5rem;">
              <div class="clearfix">
                <div class="pull-left"><span class="label">取车：</span><div class="location">${pickupLocation.cityName}</div></div>
                <p class="pull-right no-margin"><fmt:formatDate value="${order.pickupDate}" pattern="yyyy-MM-dd HH:mm" /> </p>
              </div>
              <div class="detail" style="margin-top: .25rem;padding-left: 2.1rem;display: block; max-width: 100%; font-size: .6rem; line-height: 1.3;">
                <p>${pickupLocation.name}</p>
                <p>${pickupLocation.addressOne}</p>
                <p>TEL:&nbsp;${pickupLocation.phone}</p>
                  <%-- <p>${pickupLocation.addressTwo}</p> --%>
              </div>
              <div class="icon-layout" style="position: absolute; top: 50%; left: .35rem; margin-top: -.25rem;">
	              <span class="iconfont iconfont-shophours" data-work = "pickupLocation" style="font-size: 1rem;"></span>
	            </div>
            </div>
            <div class="item" style="position: relative;">
              <div class="clearfix">
                <div class="pull-left">
                  <span class="label">还车：</span><div class="location">${returnLocation.cityName}</div>
                </div>
                <p class="pull-right no-margin"><fmt:formatDate value="${order.returnDate}" pattern="yyyy-MM-dd HH:mm" /></p>
              </div>
              <div class="detail" style="margin-top: .25rem;padding-left: 2.1rem;display: block; max-width: 100%; font-size: .6rem; line-height: 1.3;">
                <p>${returnLocation.name}</p>
                <p>${returnLocation.addressOne}</p>
                <p>TEL:&nbsp;${returnLocation.phone}</p>
              </div>
              <div class="icon-layout" style="position: absolute; top: 50%; left: .35rem; margin-top: -.25rem;">
                <span class="iconfont iconfont-shophours" data-work = "pickupLocation" style="font-size: 1rem;"></span>
	            </div>
            </div>
            <%-- <div class="item" style="position: relative; margin-bottom: .5rem;">
              <span class="label">取车：</span>
              <div class="location">${pickupLocation.cityName}</div>
              <div class="detail" style="display: block; width: 100%;">
                <p>${pickupLocation.name}</p><p><fmt:formatDate value="${order.pickupDate}" pattern="yyyy-MM-dd HH:mm" /> </p>
                <p style="margin: 0 0 .25rem;">${pickupLocation.phone}</p>
                <p>${pickupLocation.addressOne}</p>
                <p>${pickupLocation.addressTwo}</p>
              </div>
              <div class="icon-layout" style="position: absolute; top: 50%; right: .5rem; margin-top: -1rem;">
	              <span class="iconfont iconfont-shophours" data-work = "pickupLocation" style="font-size: 1.5rem;"></span>
	            </div>
            </div>
            </div>
              <div class="item" style="position: relative;">
                <span class="label">还车：</span>
                <div class="location">${returnLocation.cityName}</div>
                <div class="detail" style="display: block; width: 100%;">
                  <p>${returnLocation.name}</p><p><fmt:formatDate value="${order.returnDate}" pattern="yyyy-MM-dd HH:mm" /></p>
                  <p style="margin: 0 0 .25rem;">${returnLocation.phone}</p>
                  <p>${returnLocation.addressOne}</p>
                  <p>${returnLocation.addressTwo}</p>
                </div>
                <div class="icon-layout" style="position: absolute; top: 50%; right: .5rem; margin-top: -1rem;">
	                <span class="iconfont iconfont-shophours" data-work = "returnLocation" style="font-size: 1.5rem;"></span>
	              </div>
              </div> --%>
          </div>
        </div>
        
        <!-- <div class="list cars-list-layout">
          <div style="margin: 1.25rem .5rem 0; font-size: .75rem;">订单信息：</div>
          <div class="card fita-card order-detail-card">
	          <div class="item"><span class="label">订单金额：&nbsp;&nbsp;</span><span class="current-price">1,500.00</span></div>
	          <div class="item"><span class="label">订单号：&nbsp;&nbsp;</span><span class="">123456789042</span></div>
	          <div class="item"><span class="label">下单时间：&nbsp;&nbsp;</span><span class="">2018-12-24 15:00</span></div>
	          <div class="item"><span class="label">Alamo订单号：&nbsp;&nbsp;</span><span class="">2018-12-24 15:00</span></div>
	        </div>
        </div> -->
        
        <div class="list cars-list-layout">
          <div class="card fita-card">
            <div class="card-content">
              <div class="card-content-inner">
                <a href="">
                  <div class="car-title">
                  <c:choose>
                      <c:when test="${persist.modelGroups[order.details.carInfo.modelName] != null}">
                         ${persist.modelGroups[order.details.carInfo.modelName].chineseName}
                      </c:when>
                      <c:otherwise>
                        ${order.details.carInfo.modelName}
                      </c:otherwise>
                    </c:choose>
                  </div>
                  <div class="row no-gutter">
                    <div class="col-66 cars-type">
                      <c:choose>
                      <c:when test="${persist.modelGroups[order.details.carInfo.modelName] != null}">
                         <img src="${cloudContext.domain}/${persist.modelGroups[order.details.carInfo.modelName].picture}"/>
                      </c:when>
                      <c:otherwise>
                        <img src="${order.details.carInfo.picture}"/>
                      </c:otherwise>
                    </c:choose>
                      <p>
                      	 ${persist.getVehicleSize(order.details.carInfo.modelCodeClass).chineseName}/
                         ${persist.getVehicleCategory(order.details.carInfo.categoryCode).chineseName}/
                         ${order.details.carInfo.transmissionType  eq 'MANUAL' ? '手动' : '自动'}/
                         ${order.details.carInfo.baggageQuantity}行李/
                         ${order.details.carInfo.passengerQuantity}座位/
                         ${order.details.carInfo.airConditionIn ? '含空调' : '无空调'}/
                         ${order.details.carInfo.modelCodeType eq 'B' ? '2门' : car.modelCodeType eq 'C' ? '2或4门' : '4门或5门'}</p>
                    </div>
                    <div class="col-33 price-box" style="margin-top:.75rem;">
                      <c:choose>
                        <c:when test="${set.payType.arrivepay}">
                          <c:set var="exchangeRate" value="${persist.exchangeRate(order.currencyCode)}"/>
                          <div class="item" style="margin-bottom: 1.25rem;">
                            <p>官方零售价：</p>
                            <p class="price"><span style="font-size: .75rem;">${exchangeRate.currencySymbol}</span><fmt:formatNumber value="${order.retailAmount/100}" type="number" maxFractionDigits="2" pattern="0.00"/></p>
                          </div>
                          <div class="item" style="margin-bottom: 1.25rem;">
                            <p>返佣：</p>
                            <p class="price current-price"><span style="font-size: .75rem;">${exchangeRate.currencySymbol}</span><fmt:formatNumber value="${order.agentCommission}" type="number" maxFractionDigits="2" pattern="0.00"/></p>
                          </div>
                        </c:when>
                        <c:otherwise>
                          <div class="item" style="margin-bottom: 1.25rem;">
                            <p>官方零售价：</p>
                            <p class="price"><span style="font-size: .75rem;">￥</span><fmt:formatNumber value="${order.retailAmount/100 + 0.499999999}" type="number" maxFractionDigits="0"/>.00</p>
                          </div>
                          <div class="item" style="margin-bottom: 1.25rem;">
                            <p>${set.payType.floatPrepay ? '浮动' : '常规'}价：</p>
                            <p class="price current-price coupon-price" style="display: none;"><span style="font-size: .75rem;">￥</span><span class="number"></span></p>
                            <p class="price current-price o-price"><span style="font-size: .75rem;">￥</span><span class="number"><fmt:formatNumber value="${order.cnyPayPrice}" type="number" maxFractionDigits="2" pattern="0.00" /></span></p>
                          </div>
                        </c:otherwise>
                      </c:choose>
                    </div>
                  </div>
                </a>
              </div>
            </div>
          </div>
        </div>
        <c:if test="${!empty coupons}">
	        <div class="list-block coupon-item" style="margin: .5rem;">
			      <ul>
			        <li>
			          <div class="item-content item-link">
			            <div class="item-inner">
			              <div class="item-title label" style="font-size: .7rem;">使用优惠券</div>
			              <div class="item-input" >
			                <input type="text" class="couponPicker" placeholder="请选择优惠券" value="${userCoupon.template.name}">
			                <input type="hidden" name="coupon" value="">
			              </div>
			            </div>
			          </div>
			        </li>
			      </ul>
			      <c:choose>
						  <c:when test="${!empty userCoupon}">
						    <ul style="margin-top: .25rem; display: block;" class="coupon-result">
					        <li>
					          <div class="item-content">
					            <div class="item-inner">
					              <!-- <div class="item-title label" style="font-size: .7rem;">使用优惠券</div> -->
					              <div class="item-input" >
					                实际待支付：<span class="price"><fmt:formatNumber value="${(order.cnyPayPrice - userCoupon.amount/100 )< 0 ?  '0.00':(order.cnyPayPrice - userCoupon.amount/100 )}" type="number" maxFractionDigits="2" pattern="0.00"/></span>元
					              </div>
					            </div>
					          </div>
					        </li>
					      </ul>
						  </c:when>
						  <c:otherwise> 
						    <ul style="margin-top: .25rem; display: none;" class="coupon-result">
					        <li>
					          <div class="item-content">
					            <div class="item-inner">
					              <!-- <div class="item-title label" style="font-size: .7rem;">使用优惠券</div> -->
					              <div class="item-input" >
					                实际待支付：<span class="price"></span>元
					              </div>
					            </div>
					          </div>
					        </li>
					      </ul>
						  </c:otherwise>
						</c:choose>
				  </div>
				</c:if>
        
        <div style="margin: 1rem .5rem 1.5rem;font-weight: bold; font-size: .65rem; color: #262626;">
          <div style="margin: .5rem 0; line-height: 1;font-weight: bold; font-size: .6rem; color: #262626;">
            <p class="no-margin" style="margin-bottom: .25rem;">此预约可在 <fmt:formatDate value="${order.cancelEndDate}" pattern="yyyy/MM/dd HH:mm"/>之前取消</p>
            <p class="no-margin">订单一经确认，如乘客人未按指定时间取车，将会被罚款。</p>
          </div>
          <!-- <label>
            <input type="checkbox" name="" checked value="" style="display: inline-block;"><span style="display: inline-block;margin-left: .25rem;vertical-align: top;">我已经阅读并接受取消条款</span>
          </label> -->
        </div>
        
        <div class="pay-button-layout">
          <c:if test="${isMicroMessenger}">
            <a href="javascript:void(0);" class="button button-fill button-success wechat-button pay-button" data-type="wechat"><span class="iconfont iconfont-wechatpay" style="font-size: 1rem;"></span>微信支付</a>
          </c:if>
          <a href="javascript:void(0);" class="button unionpay-button pay-button" data-type="pc" style="color: #0F3E73; border-color: #11357F;">银行卡支付</a>
          <a href="javascript:void(0);" class="pull-right offline-pay">线下支付</a>
        </div>
        
      </div>
      <!-- <div class="content">
      <p>订单结果页</p>
        <a ctx.host="">回到首页</a>
      </div> -->
    </div>
    
    <div class="panel-overlay"></div>
    <div class="panel panel-right panel-cover fita-panel">
      <div class="list-block contacts-block no-margin">
        <p class="menu-title close-panel">关闭</p>
	      <ul>
	        <li>
	          <a href="${ctx.host}/cars/search" class="item-content item-link">
	            <div class="item-inner">
	              <div class="item-title">立即租车</div>
	            </div>
	          </a>
	        </li>
	        <%-- <li>
	          <a href="${ctx.host}/orders" class="item-content item-link">
	            <div class="item-inner">
	              <div class="item-title">我的订单</div>
	            </div>
	          </a>
	        </li> --%>
	        <li>
            <a href="${ctx.host}/profile" class="item-content item-link">
              <div class="item-inner">
                <div class="item-title">个人中心</div>
              </div>
            </a>
          </li>
	      </ul>
      </div>
    </div>
  </div>
  <%@ include file="/WEB-INF/include/script.jsp"%>
  <d:resource type="script" root="${ctx.resource}/build" src="js/page/shopping/order-info-result.js" />
  <c:if test="${isMicroMessenger}">
  <script type="text/javascript">
    require(['page/shopping/order-info-result'], function(page) {
      page.init({
        jsConfig: JSON.parse('${jsConfig}'),
        order: '${order.id}',
        needpay: '${needpay}',
        agentMobile: '${order.agent.mobile}',
        pickupLocationId: "${pickupLocation.id}",
	    returnLocationId: "${returnLocation.id}",
	    coupons: ${coupons},
      })
    })
  </script>
  </c:if>
  <c:if test="${!isMicroMessenger}">
  <script type="text/javascript">
    require(['page/shopping/order-info-result'], function(page) {
      page.init({
        order: '${order.id}',
        needpay: '${needpay}',
        agentMobile: '${order.agent.mobile}',
        pickupLocationId: "${pickupLocation.id}",
      returnLocationId: "${returnLocation.id}",
      coupons: ${coupons},
      })
    })
  </script>
  </c:if>
  
  
</body>
</html>